package test

import (
	"fmt"
	"helper"
	"net/http"
)

func testValidateDomainName(w http.ResponseWriter, r *http.Request) {
	listValidDomain := []string{"yahoo.com", "facebook.com",
		"google.to.cc", "mkyong-info.com", "mkyong.com.au",
		"verdi.com.my", "google.t.co", "google.t.t.co", "abc.99.com",
		"abc.mkyong-info.com", "abc-123.mkyong-99b.com.my"}
	listInvalidDomain := []string{"123,345.com", "mkyong",
		"mkyong.com.abcdefg123", ".com.my", "gmail.a", ".com",
		"%*.com", "youtube.com/users/abc", "google.t.t.t.t", "htt:alo.com"}
	for _, e := range listInvalidDomain {
		check := helper.ValidateDomainName(e)
		fmt.Fprintln(w, e+" -", check)
	}
	for _, e := range listValidDomain {
		check := helper.ValidateDomainName(e)
		fmt.Fprintln(w, e+" -", check)
	}
}

func testGetDomainNameFromURL(w http.ResponseWriter, r *http.Request) {
	url := "htt://alo.com"
	fmt.Fprintln(w, url+" -", helper.GetDomainNameFromURL("/test/", url))
}

func main(){
	url := "htt://alo.com"	
	fmt.Print(url+" -", helper.GetDomainNameFromURL("/test/", url))
}
